home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Anwendungen / glmatrix / source / screen_blanker.c < prev    next >
Encoding:
C/C++ Source or Header  |  2004-01-31  |  1.3 KB  |  81 lines

  1. /*#include <mgl/gl.h>*/
  2. #include "glmatrix.h"
  3. #include "glmatrix_prefs.h"
  4. #include "yarandom.h"
  5.  
  6. int width;
  7. int height;
  8.  
  9. static BOOL blanked = FALSE;
  10.  
  11. void screenblanker_init(void)
  12. {
  13.     MGLInit();
  14.  
  15.     mglChooseWindowMode(FALSE);
  16.     ya_rand_init(0);
  17. }
  18.  
  19. void screenblanker_destroy(void)
  20. {
  21.     MGLTerm();
  22. }
  23.  
  24. void screenblanker_display(void)
  25. {
  26.     if (blanked)
  27.     {
  28.         mglLockDisplay();
  29.  
  30.         draw_matrix(mps);
  31.         mglUnlockDisplay();
  32.         mglSwitchDisplay();
  33.     }
  34. }
  35.  
  36.  
  37. void screenblanker_blank(void)
  38. {
  39.     if (!blanked)
  40.     {
  41.         switch (glmatrix_prefs->glm_ScreenSize)
  42.         {
  43.             case 1: /*800x600 */
  44.                 width = 800;
  45.                 height = 600;
  46.                 break;
  47.             case 2: /*1024x768 */
  48.                 width = 1024;
  49.                 height = 768;
  50.                 break;
  51.             case 3: /*1280x1024 */
  52.                 width = 1280;
  53.                 height = 1024;
  54.                 break;
  55.             case 0: /*640x480 */
  56.             default:
  57.                 width = 640;
  58.                 height = 480;
  59.                 break;
  60.  
  61.         }
  62.  
  63.         if (mglCreateContext(0,0, width, height))
  64.         {
  65.             mglLockMode(MGL_LOCK_MANUAL);
  66.             init_matrix();
  67.         }
  68.  
  69.         blanked = TRUE;
  70.     }
  71. }
  72.  
  73. void screenblanker_unblank(void)
  74. {
  75.     if (blanked)
  76.     {
  77.         blanked = FALSE;
  78.         mglDeleteContext();
  79.     }
  80. }
  81.